package com.smile.utils;

import java.util.HashMap;
import java.util.Map;

public class PageUtils {

	public static Map<String, Object> initData(int rows, int size, int page){
		Map<String, Object> data = new HashMap<>();
		int totalPage = (rows -1)/size +1;
		boolean firstPage = page == 1 ? true : size > rows ? true : false;
		boolean lastPage = rows <= size ? true : totalPage == page ? true : false;
		data.put("firstPage", firstPage);
		data.put("lastPage", lastPage);
		data.put("pageNumber", page);
		data.put("pageSize", size);
		data.put("totalPage", totalPage);
		data.put("totalRows", rows);
		return data;
	}

	
}
